import 'package:route/route.dart';
import 'package:flutter/material.dart';

import '../pages.dart';

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("home")),
      body: _buildContent(),
    );
  }

  Widget _buildContent() {
    // do not for get set navigator observer
    return ListView(
      children: [
        ListTile(
          leading: const Icon(Icons.title),
          title: const Text("test route"),
          onTap: () => router.openFlutterPage(FlutterPages.testPageRoute),
        ),
        ListTile(
          leading: const Icon(Icons.title),
          title: const Text("test dio"),
          onTap: () => router.openFlutterPage(FlutterPages.testDioPage),
        ),
        ListTile(
          leading: const Icon(Icons.title),
          title: const Text("test ui"),
          onTap: () => router.openFlutterPage(FlutterPages.testUIPage),
        ),
        ListTile(
          leading: const Icon(Icons.title),
          title: const Text("test file cache"),
          onTap: () => router.openFlutterPage(FlutterPages.testFileCachePage),
        ),
        ListTile(
          leading: const Icon(Icons.title),
          title: const Text("test my leak"),
          onTap: () => router.openFlutterPage(FlutterPages.testLeakPage1),
        ),
        ListTile(
          leading: const Icon(Icons.title),
          title: const Text("source code"),
          onTap: () => router.openFlutterPage(FlutterPages.testSourceCodePage),
        ),
      ],
    );
  }
}
